<?php
/*
	插件概览
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
$plugin_name = $_RQ['basicname'] ? $_RQ['basicname'] : '';
if($_RQ['op']=='get'){
	//显示统计数据
		$daytime = mktime(0,0,0,date('m'),date('d'),date('Y'));
		$mounthtime =  mktime(0,0,0,date('m'),1,date('Y'));
		$access=array();
		$access['cha_day']=pdo_count('jy_yxgoodserpfw_log',array('uniacid'=>$_SESSION['uniacid'],'createtime >'=>$daytime));
		$access['cha_all']=pdo_count('jy_yxgoodserpfw_log',array('uniacid'=>$_SESSION['uniacid']));
		$access['goods_all1']=pdo_count('jy_weishop_goods',array('uniacid'=>$_SESSION['uniacid'],'status'=>1));
		$access['goods_all2']=pdo_count('jy_yxgoodserpfw_goods',array('uniacid'=>$_SESSION['uniacid']));
		$access['merch_all']=pdo_count('jy_merch_user',array('uniacid'=>$_SESSION['uniacid']));
		$access['pici_all']=pdo_count('jy_yxgoodserpfw_batch',array('uniacid'=>$_SESSION['uniacid']));
		$access['chu_all']=pdo_count('jy_yxgoodserpfw_kulog',array('uniacid'=>$_SESSION['uniacid'],'type'=>1));
		$access['codex_all']=pdo_count('jy_yxgoodserpfw_xcode',array('uniacid'=>$_SESSION['uniacid']));
		$access['code_all']=pdo_count('jy_yxgoodserpfw_code',array('uniacid'=>$_SESSION['uniacid']));
		$access['dong_all']=pdo_count('jy_yxgoodserpfw_log',array('uniacid'=>$_SESSION['uniacid'],'type'=>3));
		//月份
		for($i=0;$i<12;$i++){
				if($i==0){
					$yuestart = mktime(0,0,0,date('m'),1,date('Y'));
					$yueend = time();
					
				}else{
					$yuestart = mktime(0,0,0,date('m')-$i,1,date('Y'));
					$yueend = mktime(0,0,0,date('m')-$i+1,1,date('Y'));
				}
				$params=array('uniacid'=>$_SESSION['uniacid']);
				$params['createtime between']=array($yuestart,$yueend);
				$month12[] = date('Y-m',strtotime('-'.$i.' month'));
				//$monthaccess[]=pdo_count('core_access_log',$params);
				$monthorder[]=pdo_count('jy_yxgoodserpfw_log',$params);
				//$monthcredit2[]=pdo_getsum('core_members',$params,'credit2');
		}
		$monthorder=array_reverse($monthorder);
		$month12=array_reverse($month12);
		$return['htmls']=array(
				array('type'=>'data','one_num'=>3,'title'=>'应用今日/总数据指标','datas'=>array(
					array('title'=>'在售商品数据','data'=>$access['goods_all1']),
					array('title'=>'防伪商品数据','data'=>$access['goods_all2']),
					array('title'=>'代理商数据','data'=>$access['merch_all']),
					array('title'=>'扫码数据','data'=>$access['cha_all']),
					array('title'=>'出库数据','data'=>$access['chu_all']),
					//array('title'=>'冻结数据','data'=>$access['dong_all']),
					array('title'=>'批次数据','data'=>$access['pici_all']),
					array('title'=>'箱码数据','data'=>$access['codex_all']),
					array('title'=>'盒码数据','data'=>$access['code_all']),
				)),
				array('type'=>'echarts_arealine','ecid'=>'mobile','title'=>'扫码数据分析','datas'=>array(
					'datas'=>array(
						array('name'=>'扫码数据','value'=>$monthorder),
					),
					'xdatas'=>$month12,
				)),
		);
	exi($return);
}